package test.design_pattern.observer.listener.anno;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import test.design_pattern.observer.OrderEvent;

@Component
public class OtherListener {

    /**
     * 用注解的listener好像在所有listener种类中优先级最高
     * @param event
     */
    @EventListener
    public void test1(OrderEvent event){
        System.out.println("test1====" + event.getOrder().getId());
    }

    /**
     * 如果不传event参数，spring启动失败
     */
//    @EventListener
//    public void test2(){
//        System.out.println("test2====");
//    }
}
